package com.ylsk.mobilecheck.controller;

/**
 * 执法方移动端控制器
 */

import com.ylsk.check.domain.ReportApprLog;
import com.ylsk.check.domain.dto.CheckRecordDTO;
import com.ylsk.check.domain.dto.RectificationReviewDTO;
import com.ylsk.check.domain.so.CheckRecordSO;
import com.ylsk.check.domain.so.RectificationReviewSO;
import com.ylsk.check.domain.so.ReportInfoSO;
import com.ylsk.check.domain.vo.CheckItemVO;
import com.ylsk.check.domain.vo.CheckRecordVO;
import com.ylsk.check.domain.vo.ReportInfoVO;
import com.ylsk.check.domain.vo.TodayCheckTaskVO;
import com.ylsk.common.core.controller.BaseController;
import com.ylsk.common.core.domain.AjaxResult;
import com.ylsk.common.core.page.TableDataInfo;
import com.ylsk.mobilecheck.service.ApparitorMobileService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 施工方移动端控制器
 *
 * @author ysy
 * @date 2023-12-03
 */
@Api(tags = "移动端-执法方端接口")
@RestController
@RequestMapping("/mobileCheck/apparitor/")
public class ApparitorController extends BaseController {

    @Autowired
    private ApparitorMobileService apparitorMobileService;


    /**
     * 查询报备信息列表
     */
    @GetMapping("/listReportInfo")
    public TableDataInfo listReportInfo(ReportInfoSO reportInfoSO)
    {
        startPage();
        List<ReportInfoVO> list = apparitorMobileService.listReportInfo(reportInfoSO);
        return getDataTable(list);
    }
    /**
     * 查询报备信息不分页列表
     */
    @GetMapping("selectListReportInfo")
    public AjaxResult selectListReportInfo(ReportInfoSO reportInfoSO)
    {
        List<ReportInfoVO> list = apparitorMobileService.selectListReportInfo(reportInfoSO);
        return AjaxResult.success(list);
    }
    /**
     * 审批报备信息
     * @param reportApprLog
     * @return
     */
    @PostMapping("apprReportInfo")
    public AjaxResult apprReportInfo(@RequestBody ReportApprLog reportApprLog)
    {
        return toAjax(apparitorMobileService.apprReportInfo(reportApprLog));
    }

    /**
     * 获取施工检查内容
     * @return
     */
    @GetMapping(value = "/getCheckItem")
    public AjaxResult getCheckItem()
    {
        List<CheckItemVO> checkItemVOS = apparitorMobileService.selectCheckItemList();
        return success(checkItemVOS);
    }

    /**
     * 今日施工  不分页列表
     */
    @GetMapping("/selectTodayCheckTaskList")
    public AjaxResult selectTodayCheckTaskList(CheckRecordSO checkRecordSO)
    {
        List<TodayCheckTaskVO> list = apparitorMobileService.selectTodayCheckTaskList(checkRecordSO);
        return success(list);
    }

    /**
     * 查询施工检查记录列表
     */
    @GetMapping("/listCheckRecord")
    public TableDataInfo listCheckRecord(CheckRecordSO checkRecordSO)
    {
        startPage();
        List<?> list = apparitorMobileService.listCheckRecord(checkRecordSO);
        return getDataTable(list);
    }

    /**
     * 新增施工检查记录
     */
    @PostMapping(value = "/saveCheckRecord")
    public AjaxResult saveCheckRecord(@RequestBody CheckRecordDTO checkRecordDTO)
    {
        return toAjax(apparitorMobileService.saveCheckRecord(checkRecordDTO));
    }

    /**
     * 施工检查记录详情
     * @param checkRecordId
     * @return
     */
    @GetMapping(value = "/getCheckRecord")
    public AjaxResult getCheckRecord(Long checkRecordId)
    {
        return success(apparitorMobileService.getCheckRecord(checkRecordId));
    }

    /**
     * 施工检查问题记录详情
     * @param checkProblemId
     * @return
     */
    @GetMapping(value = "/getCheckProblem")
    public AjaxResult getCheckProblem(Long checkProblemId)
    {
        return success(apparitorMobileService.getCheckProblem(checkProblemId));
    }

    /**
     * 新增整改复查检查记录
     */
    @PostMapping(value = "/saveRectificationReview")
    public AjaxResult saveRectificationReview(@RequestBody RectificationReviewDTO rectificationReviewDTO)
    {
        return toAjax(apparitorMobileService.saveRectificationReview(rectificationReviewDTO));
    }

    /**
     * 施工完成列表
     */
    @GetMapping("/listProjectEnd")
    public TableDataInfo listProjectEnd(ReportInfoSO reportInfoSO)
    {
        startPage();
        List<ReportInfoVO> list = apparitorMobileService.listProjectEnd(reportInfoSO);
        return getDataTable(list);
    }
}
